package com.github.fuse.advise;

import com.github.fuse.annotation.Fuse;
import com.github.fuse.context.FuseContext;
import com.github.fuse.entity.AopExecute;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

/**
 * @author: wangdejun
 * @create: 2019-10-18 09:53
 **/
@Aspect
@Slf4j
@Order(-1)
public class FuseAdvise {

    @Autowired
    private FuseContext fuseContext;

    @Pointcut(value = "@within(fuse)")
    public void fusePointCut(Fuse fuse) {

    }

    @Around(value = "fusePointCut(fuse)")
    public Object around(ProceedingJoinPoint joinPoint, Fuse fuse) throws Throwable {

        return fuseContext.start(joinPoint);

    }

}
